﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Maverick.WebUI.Models.ThreadListViewModel>" %>
<%@ Import Namespace="Maverick.WebUI.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Maverick
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <header>
        <h1>Threads</h1>
    </header>
    <% foreach (var Category in Model.Categories) { %>
    
    <section>
        <header>
            <h2><%= Category.Name %> (<%= Html.ActionLink("New thread", "Add", "Threads", new { categoryID = Category.CategoryID }, null)%>)</h2>
        </header>
        
        <% foreach (var Message in Model.Messages) { %>
            <% if (Message.CategoryID == Category.CategoryID) { %>
            <article id="post<%=  Model.Messages.IndexOf(Message) %>">
                            
                    <header>
                        <%= Html.ActionLink(Message.Title, "List", "Messages", new { parentID = Message.MessageID, title = Message.TitleUrl },  null ) %> (<%= Html.ActionLink("Delete post", "Delete", "Threads", new { messageID = Message.MessageID }, null)%>)                    
                    </header>                   
                    
                    <%= Message.Text %>                    
                    
                    <footer>
                        <cite><!-- a href="#view-author-profile" --><%= Message.Author %><!-- /a --></cite>
                        <time datetime="2011-02-01T08:37" pubdate="pubdate"><%= Message.DateTime %></time>
                    </footer>                   

            </article>
            <% } %>
        <% } %>
    </section>
    
   <% } %>    

</asp:Content>
